<?php
    try {
        $key = 'gangkeyun1234567';
        $org = file_get_contents('php://input');
        // $org = "{\"encryptMsg\":\"2Flxg1Vpwvy3ZfS1UKtUb5d38K+9DLuQxgEIbH70AajD9ysDociipfR17lIAT+1ljeS+LkXDBAmvovuTWwN8KN2Afj3syAT646sBlLS7PF6eM390KGMgWr0qBLCj+R7X5g19oPdHtmjMMIk8XANyD+UPLO\/H1EjpSCP11RKNo6w7O9vD6muW5L3krgCwT6ILi0pn9JtlcZIDgLOuDdZDC2CHVt9NNAZSzFQXWendc0OHxNKu6Dc86BtM6bUoeWWa+WjjNDa0AxvEWxT6kpaWprizi8LAM+aGBDoJAgQIEjbxtQn186YOsbfdMZOEt4xEOQLZVrQ9xX7ixZ31Pc84+g==\"}";
        //file_put_contents($file, "[ ".date('Y-m-d H:i:s').' ]:'.json_encode($decryptedStr).PHP_EOL,FILE_APPEND);
        $org_res = json_decode($org,true);
        $encryptedString = $org_res['encryptMsg']; // 替换为实际的加密字符串
        //返回的消息是对象，获取信息后解密
        $decryptedStr = AESUtils::aesDecrypt($encryptedString, $key);
        $date_identifier = date('Ymd');
        $fileName = 'content_'.$date_identifier.'.txt';
        //var_dump($decryptedStr);
        file_put_contents($fileName, "[ ".date('Y-m-d H:i:s').' ]:'.json_encode($decryptedStr).PHP_EOL,FILE_APPEND);
        echo json_encode(['result'=>'success']);
        //echo "Decrypted string: " . json_encode($decryptedStr);
    } catch (Exception $e) {
        echo "Error: " . $e->getMessage();
    }


?>
